<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/wx/page/session.jsp"%>
<c:set var="userId" value="${param.userId}" />
<c:set var="deptId" value="${param.deptId}" />
<c:set var="deptCode" value="${param.deptCode}" />
<c:set var="deptParentId" value="${param.deptParentId}" />
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <title>线路管理</title>
    <link rel="stylesheet" href="${ctx}/wx/css/default.css"/>
    <script type="text/javascript" src="${ctx}/wx/js/xtable.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
    <script type="text/javascript" src="${ctx}/wx/js/alert.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/LineService.js"></script>
</head>
<body>
<p class="contact-submit">
    <input type="button" value="新增线路" onclick="insertLine()">
</p>

<SCRIPT LANGUAGE="JavaScript" type="">
    var lineThead = new Array(
            new XThead("线路名称"),
            new XThead("车辆")
    );

    var lineXTable = new XTable("line", lineThead, false);

    lineXTable.XTbodyArray = function (model) {
        var array = new Array(
                new XTbody("line", "<a href='${ctx}/wx/page/line_manage.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}&lineId=" + model.lineId + "'>" + model.lineSource + "<br>" + model.lineDest + "</a>", null, null, null, "center"),
                new XTbody("line", "<a href='${ctx}/wx/page/truck_list.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}&lineId=" + model.lineId + "'>" + model.lineTruckNum + "辆</a>", null, null, null, "center")
        );

        return array;
    }

    lineXTable.getXList = function (page){
        var line = new Line();
        line.deptId = "${deptId}";
        line.pageIndex = page;
        line.pageSize = lineXTable.pageSize;
        LineService.selectLineList(line, function(list){lineXTable.addTable(list);});
    }

    function getLinePage(){
        var line = new Line();
        line.deptId = "${deptId}";
        LineService.selectLineNum(line, function(num){lineXTable.setTotalPage(num);});
    }
</SCRIPT>
</body>
</html>
<script type="text/javascript">
    getLinePage();
    function insertLine() {
        location = "${ctx}/wx/page/line_manage.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}";
    }
</script>